package Polymorphism3;




interface IShape{
     abstract void draw();//抽象方法
//    default  void  func(){
//        System.out.println("。。。。。。");
//    }
//     static void funcStatic(){
//        System.out.println("static方法测试");
//    }
}
//矩形
class Rect implements IShape{
    @Override
    public void draw() {
        System.out.println("♦");
    }
//    @Override
//    public void func() {
//        System.out.println("测试重写默认方法");
//    }

}
// 花
class Flower implements IShape {
    @Override
    public void draw() {
        System.out.println("❀");
    }
}
//三角形
class Triangle implements IShape {
    @Override
    public void draw() {
        System.out.println("△");
    }
}
public class Test {
    public static void paint(IShape iShape){
        iShape.draw();
    }
    public static void main(String[] args) {
        IShape iShape = new Rect();
        paint(iShape);
        paint(new Rect());
        System.out.println("=========");
        IShape iShape1 = new Flower();
        paint(iShape1);
        paint(new Flower());
        System.out.println("=======");
        IShape iShape2 = new Triangle();
        paint(iShape2);
        paint(new Triangle());
    }
}
